home *** CD-ROM | disk | FTP | other *** search
- /*==============================================================================
- Project: POV-Ray
-
- Version: 3.0
-
- File: Config.h -- Macintosh version
-
- Description:
- This file contains Macintosh-specific defines, types, etc for the following
- environments:
- Symantec Think C 7 & 8
- MPW 3.3x
- Metrowerks 6+
- ------------------------------------------------------------------------------
- Authors:
- Thomas Okken, David Lichtman, Glenn Sugden
- Jim Nitchals, Eduard [esp] Schwan
- ------------------------------------------------------------------------------
- from Persistence of Vision(tm) Ray Tracer
- Copyright 1996 Persistence of Vision Team
- ------------------------------------------------------------------------------
- NOTICE: This source code file is provided so that users may experiment
- with enhancements to POV-Ray and to port the software to platforms other
- than those supported by the POV-Ray Team. There are strict rules under
- which you are permitted to use this file. The rules are in the file
- named POVLEGAL.DOC which should be distributed with this file. If
- POVLEGAL.DOC is not available or for more info please contact the POV-Ray
- Team Coordinator by leaving a message in CompuServe's Graphics Developer's
- Forum. The latest version of POV-Ray may be found there as well.
-
- This program is based on the popular DKB raytracer version 2.12.
- DKBTrace was originally written by David K. Buck.
- DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
- ------------------------------------------------------------------------------
- Change History:
- 920815 [jln] version 1.0 Mac released.
- 921105 [esp] version 1.1 beta Mac
- 930902 [esp] version 1.9 beta Mac
- 931001 [esp] version 2.0 finished (Released on 10/4/93)
- 931119 [djh] 2.0.1 source conditionally compiles for PPC machines, keyword __powerc
- 940430 [esp] Preliminary 3.0a1 work
- 940520 [esp] 2.2+ updated for Metrowerks DR/3 release
- 940604 [esp] 3.0a2
- 940807 [esp] 3.0a5
- 940905 [esp] 3.0a7 moved all compiler options (NEEDS_XXX) in here
- 941209 [esp] 3.0a12d tweaks for new FINISH_POVRAY requirement
- 960204 [esp] 3.0b4j Tweak EPSILON for PPC, added moew POV-Ray #defines from FRAME.H
- 960428 [esp] 3.0b7 Work on adding Symantec 8 support in, and prepost stuff.
- 961007 [esp] added Think C NEEDS_FPU per Steven Cartier (jewels@qnet.com)
- ==============================================================================*/
-
- #if !defined(CONFIG_H)
- #define CONFIG_H
-
- // ---------------------------------------------------------------
- // If we're not doing precompiled headers, then declare these here!
- // Note that these settings should happen BEFORE any Mac headers are read!
- // ---------------------------------------------------------------
- #if !defined(POVMACHEADERS_PCH)
- #if !defined(SystemSixOrLater)
- #define SystemSixOrLater true
- #endif // SystemSixOrLater
- #if !defined(SystemSevenOrLater)
- #define SystemSevenOrLater true
- #endif // SystemSevenOrLater
- // Use new Universal header style
- #define OLDROUTINENAMES false
- #define OLDROUTINELOCATIONS false
- #endif
-
-
- // ---------------------------------------------------------------
- // If Metrowerks, ignore the old K&R style function declarations in the code,
- // since some horrible CW8 parse errors occur otherwise!
- // (NOTE: This pragma doesn't really do anything here, just a reminder.)
- // ---------------------------------------------------------------
- #if defined (__MWERKS__)
- #pragma ignore_oldstyle on
- #endif // CodeWarrior
-
-
- // ---------------------------------------------------------------
- // FRAME.H Overrides
- // ---------------------------------------------------------------
-
- // Identifier Mac Value .. Default Value
- // ---------- --------- -- -------------
- #define POV_NAME_MAX (31-3) // 8
- #define FILE_NAME_LENGTH 255 // 150
- #define FILENAME_SEPARATOR ':' // '/'
- #define DRIVE_SEPARATOR ':'
- #define DELETE_FILE(name) remove(name) // unlink
- #define RENAME_FILE(orig,new) rename(orig,new)
-
- #if defined (powerc) || defined (__powerc)
- #define EPSILON 1.0e-7 // 1.0e-10
- #if !defined(HUGE_VAL)
- // #define HUGE_VAL 1.0e+15 // 1.0e+17
- #endif
- #else
- #define EPSILON 1.0e-10 // 1.0e-10
- #if !defined(HUGE_VAL)
- // #define HUGE_VAL 1.0e+20 // 1.0e+17
- #endif
- #endif
-
- #define BOUND_HUGE 2.0e+10 // 2.0e10
-
- #define exit(n) catch_exit(n)
-
-
- // ---------------------------------------------------------------
- // turn on/off USE_LONG_DBL to use long float or regular float
- // NOTE: MPW C 68k compiler treats long double as extended, the native type,
- // so supposedly there would be less converting happening.
- // ---------------------------------------------------------------
-
- #if !defined (powerc) && !defined (__powerc)
- #define USE_LONG_DBL 1
- #endif
-
- #if defined(USE_LONG_DBL)
- #define DBL long double
- #define DBL_FORMAT_STRING "%Lf"
- #else
- #define DBL double
- #define DBL_FORMAT_STRING "%lf"
- #endif // USE_LONG_DBL
-
- #define ALTMAIN 1 // 0 (1 makes main() into a subroutine)
- #define MAIN_RETURN_TYPE int // main() return type
- #define MAIN_RETURN_STATEMENT return 0; // main() return statement
- #define ANSIFUNC 1 // Yes, we are ANSI prototype compliant!
- #define DEFAULT_OUTPUT_FORMAT 't' // targa
- #define DEFAULT_DISPLAY_GAMMA 1.8 // 2.2
- #define DEFAULT_ASSUMED_GAMMA 1.0 // 1.0
- #define SNGL float
- #define COLC float
- #define CONST const
- // #define const
- #define IFF_SWITCH_CAST (long)
- #define QSORT_FUNCT_RET int
- #define QSORT_FUNCT_PARAM const void *
-
-
- // ---------------------------------------------------------------
- // ZLIB and PNG stuff
- // ---------------------------------------------------------------
- #if !defined(MACOS)
- // ---- ZLib stuff
- #define MACOS
- #define STDC
- #define HAVE_MEMCPY
- #define MY_ZCALLOC
- #define Z_PREFIX
- // ---- PNG Stuff
- #define PNG_INTERNAL
- #endif
-
-
- // ---------------------------------------------------------------
- // pre/post-processing routines that can be called
- // ---------------------------------------------------------------
-
- // Called at the beginning of POV-Ray engine main
- #define STARTUP_POVRAY
-
-
- // FINISH_POVRAY is called on normal OR abnormal termination,
- // only call exit() if ABNORMAL on the Mac.
- #define FINISH_POVRAY(ev) {if (ev) exit(ev);} // called before exiting engine
-
- // between render shell-out command processing, not used for now on Mac
- #define POV_SHELLOUT(shell_t) Mac_Shellout(shell_t)
- #define POV_SYSTEM(cmdstr) Mac_SystemCall(cmdstr)
- #define POV_MAX_CMD_LENGTH 100 // 250 (size of cmdstr)
-
- #define POV_PRE_RENDER Mac_PreRender();
- #define POV_PRE_SHUTDOWN Mac_PreShutdown();
- #define POV_POST_SHUTDOWN Mac_PostShutdown();
-
- // READ_ENV_VAR is supposed to be the name of the default "POVRAY.INI" file,
- // but the Mac reads the default file name from the resource file, as an
- // indexed string (STR#) instead. See PREPOST.C, Mac_Process_Povray_Ini().
- #define READ_ENV_VAR
- // Read and process any INI (configuration) file on each render
- #define PROCESS_POVRAY_INI Mac_Process_Povray_Ini();
- // called after normal write-ini-file call
- #define ALT_WRITE_INI_FILE
-
- // before aa applied
- #define POV_PRE_PIXEL(x,y,c)
- // after aa applied
- #define POV_POST_PIXEL(x,y,c)
-
-
- // ---------------------------------------------------------------
- #define RADSTATS 1 // turn on Radiosity statistics display
-
- // time statistics routines
- #define MAC_TICKS LMGetTicks() // toolbox call
- #define START_TIME tstart = MAC_TICKS;
- #define STOP_TIME tstop = MAC_TICKS;
- #define TIME_ELAPSED ((tstop - tstart) / 60L);
-
- // multitasking support, sort of :-)
- #define TEST_ABORT Cooperate(false); // moderately high-level
- #define COOPERATE_0 Cooperate(false); // high-level, not called often
- #define COOPERATE_1 Cooperate(false); // deeper, called inside tighter loops
-
- // Note that credits-printing is done once at Mac startup, not each call to POV-Ray
- #define PRINT_CREDITS // called directly in Pov.c
- #define PRINT_OTHER_CREDITS // called directly in Pov.c
-
- // Machine-specific plot routines, see ImageWindow.C
- #define POV_DISPLAY_INIT(w,h) POV_Mac_Display_Init((w),(h))
- #define POV_DISPLAY_CLOSE POV_Mac_Display_Close();
- #define POV_DISPLAY_FINISHED POV_Mac_Display_Finished();
- #define POV_DISPLAY_PLOT(x,y,r,g,b,a) POV_Mac_Display_Plot((x),(y),(r),(g),(b),(a))
- #define POV_DISPLAY_PLOT_RECT(x1,x2,y1,y2,r,g,b,a) POV_Mac_Display_Plot_Rect((x1),(x2),(y1),(y2),(r),(g),(b),(a))
-
- // Machine-specific image_map file routines (PICT for the Mac, sysMacPict.c)
- #define GET_SYS_FILE_HANDLE() 0 // Get_MacPICT_File_Handle()
- #define READ_SYS_IMAGE(i,n) 0 // Read_MacPICT_Image((i),(n))
- #define SYS_DEF_EXT ".pict"
-
- // Turn ON to use histogram timer routines
- // (Not yet implemented on the Mac)
- #define PRECISION_TIMER_AVAILABLE 0
- #if PRECISION_TIMER_AVAILABLE
- #define PRECISION_TIMER_INIT Mac_PTimerInit();
- #define PRECISION_TIMER_START Mac_PTimerOn();
- #define PRECISION_TIMER_STOP Mac_PTimerOff();
- #define PRECISION_TIMER_COUNT Mac_PTimerCount();
- void Mac_PTimerInit();
- void Mac_PTimerOn();
- void Mac_PTimerOff();
- unsigned long Mac_PTimerCount();
- #endif
-
-
- // ---------------------------------------------------------------
- // #define WAIT_FOR_KEYPRESS
- // #define POV_RAND() POV_Std_rand()
- // #define POV_SRAND(i) POV_Std_srand(i)
- // #define POV_BANNER(s) POV_Std_Banner(s)
- // #define POV_WARNING(s) POV_Std_Warning(s)
- // #define POV_RENDER_INFO(s) POV_Std_Render_Info(s)
- // #define POV_STATUS_INFO(s) POV_Std_Status_Info(s)
- // #define POV_DEBUG_INFO(s) POV_Std_Debug_Info(s)
- // #define POV_FATAL(s) POV_Std_Fatal(s)
- // #define POV_STATISTICS(s) POV_Std_Statistics(s)
-
-
- // ---------------------------------------------------------------
- // MEMIO.C - uncomment appropriate flags to turn on certain functionality
- #define MEM_RECLAIM // Enables garbage collection
- // #define MEM_TAG // Enables memory tag debugging
- // #define MEM_TRACE // Enables garbage collection (MEM_RECLAIM) and memory tracing (MEM_TAG)
- #define MEM_STATS 1 // Enables tracking of memory statistics
-
-
- /*---------------------------------------------------------------------------
- Flags to enable certain Macintosh compile-time functionality
- ---------------------------------------------------------------------------*/
-
- #define PROJECT_POVRAY // tell Generic routines which project this is
-
- // POV.C - uncomment appropriate flags to turn on certain compiler options.
- // These flags assume that the project is being built with similar flags set
- // for the compiler... please make sure they match!!!
- #if !defined(applec)
- // NOTE : MPW sets these flags in the Make file, not here.
- #define NEEDS_68020 1 // turn on to force 68020 or better CPU code
- #define NEEDS_COLORQD 1 // turn on to force Color Quickdraw ROM Support
- #define NEEDS_32BITQD 1 // turn on to force 32Bit Quickdraw ROM Support
- #if (defined(__MWERKS__) && (__MC68881__)) || defined(THINK_C)
- #define NEEDS_FPU 1 // turn on to force 68881 FPU calls
- #endif
- // #define NEEDS_DEBUG 1 // turn on to add more internal debug stmts
- // #define NEEDS_PROF 1 // turn on to do profiling
- #endif
-
-
- // ---------------------------------------------------------------
- // What compiler are we using?
- // ---------------------------------------------------------------
-
- #if defined (applec) && !defined (THINK_C)
- // Apple's Macintosh Programmer's Workshop
- #define COMPILER_VER ".MacMPW"
- #endif // applec && !THINK_C
-
- #if defined (THINK_C)
- // Symantec Think Project Mgr 7, 68K
- #define COMPILER_VER ".MacThink"
- #endif // THINK_C
-
- #if defined (__SC__)
- // Symantec Project Mgr 8, 68K/PPC
- #define COMPILER_VER ".MacSymantec"
- #endif // THINK_C
-
- #if defined (gcc)
- // Gnu CC
- #define COMPILER_VER ".MacGNU"
- #endif // gcc
-
- #if defined (__MWERKS__)
- // Metrowerks CodeWarrior
- #define COMPILER_VER ".MacCodeWarrior"
- #endif // CodeWarrior
-
- // >>> Add new compilers here! <<<
-
- #if defined(__MRC__)
- // MrC (New MPW/ETO PowerPC Compiler)
- #define COMPILER_VER ".MacMrC"
- #endif // COMPILER_VER
-
- #if !defined(COMPILER_VER)
- // Unknown
- #define COMPILER_VER ".Mac???"
- #endif // COMPILER_VER
-
-
- // ---------------------------------------------------------------
- // Some standard C headers
- // ---------------------------------------------------------------
- #include <stdio.h>
- #include <stdarg.h>
- #include <stdlib.h>
-
- // Since math.h is hard-included BEFORE config.h in the FRAME.H header,
- // we cannot just go include fp.h here, sad but true
- // #include <fp.h> // new superset of math.h
-
- // #include <math.h> // no smart headers, have to use it
-
- #if defined(_PI)
- #define M_PI pi
- #define M_PI_2 (pi/2.0)
- #define TWO_M_PI (pi*2.0)
- #define M_PI_180 (pi/180.0)
- #define M_PI_360 (pi/360.0)
- #endif
-
- // ---------------------------------------------------------------
- // essential prototypes for some MACROS above
- // ---------------------------------------------------------------
-
- #include "PovMacProto.h"
- #include "ImageWindow.h"
- #include "PrePost.h" // prototypes for Mac_Process_Povray_Ini() etc.
- #include "Stdio_p2w.h"
-
-
-
- #endif /* CONFIG_H */
-